import request, { download } from '@/utils/request'

// 获取采样点位下拉列表
export function getSamplingLocationList() {
  return request({
    url: '/operation/web/operationLaboratoryDataRecording/samplingLocationList',
    method: 'get'
  })
}

// 获取检测指标下拉列表
export function getWaterQualityParameterList() {
  return request({
    url: '/operation/web/operationLaboratoryDataRecording/waterQualityParameterList',
    method: 'get'
  })
}

// 查询化验数据记录列表
export function getLabDataRecordList(params) {
  return request({
    url: '/operation/web/operationLaboratoryDataRecording/list',
    method: 'get',
    params
  })
}

// 获取化验数据记录详细信息
export function getLabDataRecordDetail(id) {
  return request({
    url: `/operation/web/operationLaboratoryDataRecording/${id}`,
    method: 'get'
  })
}

// 新增化验数据记录
export function addLabDataRecord(data) {
  return request({
    url: '/operation/web/operationLaboratoryDataRecording',
    method: 'post',
    data
  })
}

// 修改化验数据记录
export function updateLabDataRecord(data) {
  return request({
    url: '/operation/web/operationLaboratoryDataRecording',
    method: 'put',
    data
  })
}

// 删除化验数据记录
export function deleteLabDataRecord(ids) {
  return request({
    url: `/operation/web/operationLaboratoryDataRecording/${ids}`,
    method: 'delete'
  })
}

// 导出化验数据记录
export function exportLabDataRecord(params) {
  return download(
    '/operation/web/operationLaboratoryDataRecording/export',
    params,
    `化验数据记录_${Date.now()}.xlsx`
  )
}

// 导入化验数据记录
export function importLabDataRecord(data) {
  return request({
    url: '/operation/web/operationLaboratoryDataRecording/importData',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 下载导入模板
export function downloadLabDataTemplate() {
  return download(
    '/operation/web/operationLaboratoryDataRecording/importTemplate',
    {},
    '化验数据记录导入模板.xlsx'
  )
}